mod auto_debug;
mod auto_deref;
mod enum_from;
mod enum_from_darling;
use crate::{
    auto_debug::process_auto_debug, auto_deref::process_auto_deref, enum_from::process_enum_from,
    enum_from_darling::process_enum_from_darling,
};
use proc_macro::TokenStream;

// proc macro crate
#[proc_macro_derive(EnumFrom)]
pub fn derive_enum_from(input: TokenStream) -> TokenStream {
    // quote return proc-macro2 TokenStream so we need to convert it to proc-macro TokenStream
    let input = syn::parse_macro_input!(input as syn::DeriveInput);
    process_enum_from(input).into()
}

#[proc_macro_derive(EnumFromDarling)]
pub fn derive_enmu_from_darling(input: TokenStream) -> TokenStream {
    let input = syn::parse_macro_input!(input as syn::DeriveInput);
    process_enum_from_darling(input).into()
}

#[proc_macro_derive(AutoDeref, attributes(deref))]
pub fn derive_auto_deref(input: TokenStream) -> TokenStream {
    let input = syn::parse_macro_input!(input as syn::DeriveInput);
    process_auto_deref(input).into()
}

#[proc_macro_derive(AutoDebug, attributes(debug))]
pub fn derive_auto_debug(input: TokenStream) -> TokenStream {
    let input = syn::parse_macro_input!(input as syn::DeriveInput);
    process_auto_debug(input).into()
}
